import Vuex from "vuex";
import router from "@/router/index.js";

export const store = new Vuex.Store({
    // state专门用来保存 共享的状态值
    state: {
        studentIndex: 0, // 审批页面的索引
        bugDialog: false,
        teacherFeedBackDialog: false,
        oneTeacherFeedBackDialog: false,
        complexUpload: false, // 学生上传综测
        complexUpdate: false, // 老师提交学生综测
        changeComplex: false, // 综测管理员修改学生综测
        complexDetail: false, // 查看详情
        accountNo: "",
        year: "",
        complexContent: []
    },
    // mutations: 专门书写方法,用来更新 state 中的值
    mutations: {
        bugDialogShow(state) {
            state.bugDialog = !state.bugDialog;
        },
        teacherDialogShow(state) {
            state.teacherFeedBackDialog = !state.teacherFeedBackDialog;
        },
        oneTeacherDialogShow(state) {
            state.oneTeacherFeedBackDialog = !state.oneTeacherFeedBackDialog;
        },
        complexUploadSetFalse(state) {
            state.complexUpload = false
        },
        complexUploadSetTrue(state, result) {
            state.complexContent = result
            state.complexUpload = true
        },
        complexUpdateSetFalse(state) {
            state.complexUpdate = false
        },
        complexUpdateSetTrue(state, result) {
            state.complexContent = result
            state.complexUpdate = true
        },
        complexDetailSetTrue(state) {
            state.complexDetail = true
        },
        setAccountN0(state, result) {
            state.accountNo = result
        },
        setYear(state, result) {
            state.year = result
        },
        setStudentIndex(state, result) {
            state.studentIndex = result
        },
        setChangeComplexTrue(state) {
            state.changeComplex = true
        },
        setChangeComplexFalse(state) {
            state.changeComplex = false
        }
    },
    actions: {},
    modules: {}
});

// 整合初始状态和变更函数，我们就得到了我们所需的 store
// 至此，这个 store 就可以连接到我们的应用中
export default store
